package com.qhm123.spark.model;

public class Book {

	public String id;
	public String title;
	public String author;
	public String pubdate;
	public String imageurl;
	public String summary;
	public String price;
	public String isbn;
	public float rating;
	public boolean isInCart;
	public long time;
	public boolean isShort;
	public String publisher;
	public String translator;
	public String subtitle;
	public int ratingNum;
	public int reviewTotal;
	public int relateTotal;

	public Book() {
		this.id = "";
		this.isbn = "";
		this.title = "";
		this.author = "";
		this.pubdate = "";
		this.imageurl = "";
		this.summary = "";
		this.price = "";
		this.rating = 0;
		this.isInCart = false;
		this.time = 0;
		this.isShort = false;
		this.publisher = "";
		this.translator = "";
		this.subtitle = "";
		this.ratingNum = 0;
		this.reviewTotal = 0;
		this.relateTotal = 0;
	}

	public Book(String id, String title, String author, String pubdate,
			String imageurl) {
		this.id = id;
		this.title = title;
		this.author = author;
		this.pubdate = pubdate;
		this.imageurl = imageurl;
	}

	@Override
	public String toString() {
		return String.format("Book(%s,%s,%s,%s)", id, title, author, pubdate);
	}

	@Override
	public boolean equals(Object o) {
		if (this.id == null || ((Book) o) == null || ((Book) o).id == null) {
			return false;
		}
		return this.id.equals(((Book) o).id) ? true : false;
	}

}
